#include <iostream>
#include <vector>
#include <list>
#include <iterator>
#include <algorithm>
#include <set>
#include <functional>

using namespace std;

int func(int x1, int x2, int x3, const int &x4, int x5) {
    cout << x1 << endl;
    cout << x2 << endl;
    cout << x3 << endl;
    cout << x4 << endl;
    cout << x5 << endl;
}

void test0() {
    int number = 500;
    using namespace std::placeholders;
//    占位符整体代表的是函数形参的位置
//    占位符数字代表实参的位置
//    cref 引用传递
    auto f = bind(func, 100, _5, _7, cref(number), number);

    f(1, -1, -1, 4, 5, 4, 101, 44, 1111);
}

class Example {
public:
    int add(int x, int y) {
        cout << "int Example::add(int, int)" << endl;
        return x + y;
    }
    int data = 100;//C++11中初始化数据成员的新方式
};
int main() {
    Example ex;
    function<int()> f = bind(&Example::data, &ex);
    cout << "f() = " << f() << endl;//打印的结果就是100
    copy()
    return 0;
}
